
import com.cec.mediatR.service.IMediator;
import com.cec.mediatR.handler.IRequestHandler;

public class DemoBService implements IDemoBService, IRequestHandler<RequestBService, String> {
    private final IMediator mediator;

    public DemoBService(IMediator mediator) {
        this.mediator = mediator;
    }

    @Override
    public String handle(RequestBService request) {
        return this.helloWithA();
    }

    @Override
    public String hello() {
        RequestAService requestAService=new RequestAService();
        requestAService.setName("zhangsan");
        return this.mediator.send(requestAService);
    }

    @Override
    public String helloWithA() {
        return "call B in A";
    }
}
